package com.jiangjiang.eshop.order.service;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jiangjiang.eshop.order.convert.OrderOperateLogConvert;
import com.jiangjiang.eshop.order.dao.OrderOperateLogMapper;
import com.jiangjiang.eshop.order.domain.OrderOperateLogEntity;
import com.jiangjiang.eshop.order.dto.OrderOperateLogDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @ClassName OrderOperateLogService
 * @Description TODO
 * @Author jhw
 * @Date 2021/8/24 21:09
 * @Version 1.0
 **/
@Service
public class OrderOperateLogService extends ServiceImpl<OrderOperateLogMapper, OrderOperateLogEntity> {
    @Autowired
    private OrderOperateLogConvert orderOperateLogConvert;

    /**
     *
     * @param orderInfoId 订单id
     * @return
     */
    public List<OrderOperateLogDTO> queryByOrderInfoId(Long orderInfoId) {
        LambdaQueryWrapper<OrderOperateLogEntity> wrapper = Wrappers.lambdaQuery();
        wrapper.eq(OrderOperateLogEntity::getOrderInfoId, orderInfoId);
        return orderOperateLogConvert.convertEntities2DTOList(this.list(wrapper));
    }
}
